home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 4 / Meeting Pearls Vol. IV (1996)(GTI - Schatztruhe)[!].iso / Pearls / etech / GALer20 / Source / GALer / JEDEC.c < prev    next >
C/C++ Source or Header  |  1996-04-05  |  44KB  |  1,491 lines

  1. /******************************************************************************
  2. ** JEDEC.c
  3. *******************************************************************************
  4. **
  5. ** description:
  6. **
  7. ** This file contains some functions to load and save GAL data in JEDEC format.
  8. **
  9. ******************************************************************************/
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16. /********************************* includes **********************************/
  17.  
  18. #include <exec/types.h>
  19. #include <exec/memory.h>
  20. #include <libraries/dos.h>
  21. #include <libraries/locale.h>
  22. #include <stdio.h>
  23. #include <ctype.h>
  24. #include <stdio.h>
  25.  
  26. #include <proto/locale.h>
  27. #include <proto/dos.h>
  28. #include <proto/intuition.h>
  29. #include <proto/exec.h>
  30.  
  31. #include "GALer.h"
  32. #include "Localize.h"
  33.  
  34.  
  35.  
  36.  
  37.  
  38. /********************************** defines **********************************/
  39.  
  40.  
  41.  
  42.  
  43.  
  44. /******************************** functions **********************************/
  45.  
  46.  
  47.  
  48.  
  49.  
  50. /******************************** variables **********************************/
  51.  
  52. extern  struct  AppString { LONG   as_ID;
  53.                             STRPTR as_Str;
  54.                           };
  55.  
  56. extern  struct  AppString AppStrings[];
  57.  
  58. extern  int     MaxFuseAdr, RowSize, XORSize, GALType;
  59. extern  char    path;
  60.  
  61. extern  struct  Configuration   Config;
  62. extern  struct  Catalog         *catalog;
  63.  
  64. struct  JedecStruct     Jedec;
  65.  
  66.  
  67. int     linenum, JedecSecurity, JedecGALType;
  68. int     oldMaxFuseAdr, oldRowSize, oldXORSize;
  69.  
  70. UBYTE   *actptr, *buffend;
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78. /******************************************************************************
  79. ** PutJedec()
  80. *******************************************************************************
  81. ** input:   none
  82. ** output:  none
  83. **
  84. ** remarks: read GAL and generate JEDEC structure and write JEDEC file
  85. ******************************************************************************/
  86.  
  87. void PutJedec(void)
  88. {
  89.  
  90.     if (GALTypeRequest(AppStrings[MSG_READGAL_JED].as_Str))
  91.     {
  92.         if (ReadGALParameter(YES))              /* get parameter or GAL */
  93.             return;                             /* error -> return      */
  94.  
  95.         PrintText(AppStrings[MSG_READING_GAL].as_Str, 1);
  96.  
  97.         ReadGALToJedec();                                  /* read GAL */
  98.  
  99.         PrintText(AppStrings[MSG_LOWER_OK].as_Str, 0);
  100.  
  101.         if (MyFileReq(AppStrings[MSG_WRITE_JED].as_Str, ".jed", YES, SAVE))
  102.             WriteJedecFile(GALType);
  103.  
  104.     }
  105. }
  106.  
  107.  
  108.  
  109.  
  110.  
  111. /******************************************************************************
  112. ** FileChecksum()
  113. *******************************************************************************
  114. ** input:   buff    ActBuffer structure of file buffer
  115. **
  116. ** output:          16 bit checksum of the JEDEC structure
  117. **
  118. ** remarks: This function calculates the JEDEC file checksum. The start and
  119. **          the end of the area for which the checksum should be calculated
  120. **          must be marked by <STX> and <ETX>!.
  121. ******************************************************************************/
  122.  
  123. int FileChecksum(struct ActBuffer buff)
  124. {
  125.     int checksum;
  126.  
  127.  
  128.     checksum = 0;
  129.  
  130.     while (*buff.Entry != 0x2)                  /* search for <STX> */
  131.         IncPointer(&buff);
  132.  
  133.     while (*buff.Entry != 0x3)
  134.     {                                           /* search for <ETX> and */
  135.         checksum += *buff.Entry;                /* add values           */
  136.  
  137.         IncPointer(&buff);
  138.     }
  139.  
  140.     checksum += 0x3;                              /* add <ETX> too */
  141.  
  142.     return(checksum);                             /* ready */
  143. }
  144.  
  145.  
  146.  
  147.  
  148.  
  149. /******************************************************************************
  150. ** FuseChecksum()
  151. *******************************************************************************
  152. ** input:   galtype     type of GAL
  153. **
  154. ** output:              16 bit checksum of the JEDEC structure
  155. **
  156. ** remarks: This function does calculate the fuse checksum of the JEDEC
  157. **          structure.
  158. ******************************************************************************/
  159.  
  160. int FuseChecksum(int galtype)
  161. {
  162.     int     checksum, byte, n;
  163.     BYTE    *ptr, *ptrXOR, *ptrS1;
  164.  
  165.  
  166.  
  167.     ptr    = &Jedec.GALLogic[0] - 1L;
  168.     ptrXOR = &Jedec.GALXOR[0];
  169.     ptrS1  = &Jedec.GALS1[0];
  170.  
  171.     n = checksum = byte = 0;
  172.  
  173.     for (;;)
  174.     {
  175.  
  176.         if (galtype == GAL16V8)
  177.         {
  178.             if (n == XOR16)
  179.             {
  180.                 ptr = &Jedec.GALXOR[0];
  181.             }
  182.             else
  183.             {
  184.                 if (n == XOR16+8)
  185.                 {
  186.                     ptr = &Jedec.GALSig[0];
  187.                 }
  188.                 else
  189.                 {
  190.                     if (n == NUMOFFUSES16)
  191.                         break;
  192.                     else
  193.                         ptr++;
  194.                 }
  195.             }
  196.         }
  197.  
  198.  
  199.         if (galtype == GAL20V8)
  200.         {
  201.             if (n == XOR20)
  202.             {
  203.                 ptr = &Jedec.GALXOR[0];
  204.             }
  205.             else
  206.             {
  207.                 if (n == XOR20+8)
  208.                 {
  209.                     ptr = &Jedec.GALSig[0];
  210.                 }
  211.                 else
  212.                 {
  213.                     if (n == NUMOFFUSES20)
  214.                         break;
  215.                     else
  216.                         ptr++;
  217.                 }
  218.             }
  219.         }
  220.  
  221.  
  222.         if (galtype == GAL22V10)
  223.         {
  224.             if (n >= XOR22V10 && n < XOR22V10 + 20)
  225.             {
  226.                 if (!(n % 2))
  227.                     ptr = ++ptrXOR;
  228.                 else
  229.                     ptr = ++ptrS1;
  230.             }
  231.             else
  232.             {
  233.                 if (n == SIG22V10)
  234.                     ptr = &Jedec.GALSig[0] - 1L;
  235.  
  236.                 if (n == SIG22V10 + SIG_SIZE)
  237.                     break;
  238.                 else
  239.                     ptr++;
  240.             }
  241.         }
  242.  
  243.  
  244.         if (galtype == GAL20RA10)
  245.         {
  246.             if (n == XOR20RA10)
  247.             {
  248.                 ptr = &Jedec.GALXOR[0];
  249.             }
  250.             else
  251.             {
  252.                 if (n == SIG20RA10 + SIG_SIZE)
  253.                     break;
  254.                 else
  255.                     ptr++;
  256.             }
  257.         }
  258.  
  259.  
  260.         byte |= (*ptr << (n+8) % 8);
  261.  
  262.         if (!((n + 9)%8))
  263.         {
  264.             checksum += byte;
  265.             byte = 0;
  266.         }
  267.  
  268.         n++;
  269.     }
  270.  
  271.     checksum += byte;
  272.  
  273.     return(checksum);
  274. }
  275.  
  276.  
  277.  
  278.  
  279.  
  280. /******************************************************************************
  281. ** MakeJedecBuff()
  282. *******************************************************************************
  283. ** input:   buff     ActBuffer structure for the ram buffer
  284. **          galtype  type of GAL
  285. **
  286. ** output:  0:  o.k.
  287. **         -1:  not enough free memory
  288. **
  289. ** remarks: generates the JEDEC file in a ram buffer
  290. ******************************************************************************/
  291.  
  292. int MakeJedecBuff(struct ActBuffer buff, int galtype)
  293. {
  294.     UBYTE   mystrng[10];
  295.     struct  ActBuffer buff2;
  296.     int     n, m, bitnum, bitnum2, flag;
  297.     int     MaxFuseAdr, RowSize, XORSize;
  298.  
  299.  
  300.     switch (galtype)
  301.     {
  302.  
  303.          case  GAL16V8:
  304.                  MaxFuseAdr = MAX_FUSE_ADR16; /* This variables are defined  */
  305.                  RowSize    = ROW_SIZE_16V8;  /* both globally AND locally!  */
  306.                  XORSize    = 8;              /* All assignments concern to  */
  307.                  break;                       /* the locale variables!!!!    */
  308.  
  309.          case GAL20V8:
  310.                  MaxFuseAdr = MAX_FUSE_ADR20;
  311.                  RowSize    = ROW_SIZE_20V8;
  312.                  XORSize    = 8;
  313.                  break;
  314.  
  315.          case GAL22V10:
  316.                  MaxFuseAdr = MAX_FUSE_ADR22V10;
  317.                  RowSize    = ROW_SIZE_22V10;
  318.                  XORSize    = 10;
  319.                  break;
  320.  
  321.          case GAL20RA10:
  322.                  MaxFuseAdr = MAX_FUSE_ADR20RA10;
  323.                  RowSize    = ROW_SIZE_20RA10;
  324.                  XORSize    = 10;
  325.                  break;
  326.     }
  327.  
  328.  
  329.  
  330.     buff2 = buff;
  331.  
  332.     if (Config.JedecFileChk)
  333.         if (AddString(&buff, (UBYTE *)"\2\n"))          /* <STX> */
  334.             return(-1);
  335.  
  336.                                         /*** make header of JEDEC file ***/
  337.     if (AddString(&buff, (UBYTE *)"Used Program:   GALer V2.0\n"))
  338.         return(-1);
  339.  
  340.     if (AddString(&buff, (UBYTE *)"GAL-Assembler:  GALer V2.0\n"))
  341.         return(-1);
  342.  
  343.     if (galtype == GAL16V8)
  344.     {
  345.         if (AddString(&buff, (UBYTE *)"Device:         GAL16V8\n\n"))
  346.             return(-1);
  347.     }
  348.  
  349.     if (galtype == GAL20V8)
  350.     {
  351.         if (AddString(&buff, (UBYTE *)"Device:         GAL20V8\n\n"))
  352.             return(-1);
  353.     }
  354.  
  355.     if (galtype == GAL20RA10)
  356.     {
  357.         if (AddString(&buff, (UBYTE *)"Device:         GAL20RA10\n\n"))
  358.             return(-1);
  359.     }
  360.  
  361.     if (galtype == GAL22V10)
  362.     {
  363.         if (AddString(&buff, (UBYTE *)"Device:         GAL22V10\n\n"))
  364.             return(-1);
  365.     }
  366.  
  367.  
  368.     if (AddString(&buff, (UBYTE *)"*F0\n"))     /* default value of fuses */
  369.         return(-1);
  370.  
  371.     if (Config.JedecSecBit)
  372.     {                                               /* Security-Bit */
  373.         if (AddString(&buff, (UBYTE *)"*G1\n"))
  374.             return(-1);
  375.     }
  376.     else
  377.         if (AddString(&buff, (UBYTE *)"*G0\n"))
  378.             return(-1);
  379.  
  380.  
  381.     if (galtype == GAL16V8)                       /* number of fuses */
  382.         if (AddString(&buff, (UBYTE *)"*QF2194\n"))
  383.             return(-1);
  384.  
  385.     if (galtype == GAL20V8)
  386.         if (AddString(&buff, (UBYTE *)"*QF2706\n"))
  387.             return(-1);
  388.       
  389.     if (galtype == GAL20RA10)
  390.         if (AddString(&buff, (UBYTE *)"*QF3274\n"))
  391.             return(-1);
  392.  
  393.     if (galtype == GAL22V10)
  394.         if (AddString(&buff, (UBYTE *)"*QF5892\n"))
  395.             return(-1);
  396.  
  397.                                                 /*** make fuse-matrix ***/
  398.  
  399.     bitnum = 0;
  400.  
  401.     for (m = 0; m < RowSize; m++)
  402.     {
  403.         flag = 0;
  404.  
  405.         bitnum2 = bitnum;
  406.  
  407.         for (n = 0; n <= MaxFuseAdr; n++)
  408.         {
  409.             if (Jedec.GALLogic[bitnum2])
  410.             {
  411.                 flag = 1;
  412.                 break;
  413.             }
  414.  
  415.             bitnum2++;
  416.         }
  417.  
  418.         if (flag)
  419.         {
  420.             sprintf((char *)&mystrng[0], "*L%04d \0", bitnum);
  421.  
  422.             if (AddString(&buff, (UBYTE *)&mystrng[0]))
  423.                 return(-1);
  424.  
  425.             for (n=0; n<=MaxFuseAdr; n++)
  426.             {
  427.                 if (AddByte(&buff, (UBYTE)(Jedec.GALLogic[bitnum] + '0')))
  428.                     return(-1);
  429.                 bitnum++;
  430.             }
  431.  
  432.             if (AddByte(&buff, (UBYTE)'\n'))
  433.                 return(-1);
  434.  
  435.         }
  436.         else
  437.             bitnum = bitnum2;
  438.     }
  439.  
  440.     if (!flag)
  441.         bitnum = bitnum2;
  442.  
  443.  
  444.                                                 /*** XOR-Bits ***/
  445.     sprintf((char *)&mystrng[0], "*L%04d \0", bitnum);    /* add fuse adr. */
  446.     if (AddString(&buff, (UBYTE *)&mystrng[0]))
  447.         return(-1);
  448.  
  449.     for (n = 0; n < XORSize; n++)
  450.     {
  451.         if (AddByte(&buff, (UBYTE)(Jedec.GALXOR[n] + '0')))
  452.             return(-1);
  453.         bitnum++;
  454.  
  455.         if (galtype == GAL22V10)
  456.         {                                           /*** S1 of 22V10 ***/
  457.             if (AddByte(&buff, (UBYTE)(Jedec.GALS1[n] + '0')))
  458.                 return(-1);
  459.             bitnum++;
  460.         }
  461.     }
  462.  
  463.     if (AddByte(&buff, (UBYTE)'\n'))
  464.         return(-1);
  465.  
  466.  
  467.                                                 /*** Signature ***/
  468.     sprintf((char *)&mystrng[0], "*L%04d \0", bitnum);
  469.  
  470.     if (AddString(&buff, (UBYTE *)&mystrng[0]))
  471.         return(-1);
  472.  
  473.     for (n = 0; n < SIG_SIZE; n++)
  474.     {
  475.         if (AddByte(&buff, (UBYTE)(Jedec.GALSig[n] + '0')))
  476.             return(-1);
  477.         bitnum++;
  478.     }
  479.  
  480.     if (AddByte(&buff, (UBYTE)'\n'))
  481.         return(-1);
  482.  
  483.  
  484.  
  485.     if ((galtype == GAL16V8) || (GALType == GAL20V8))
  486.     {
  487.                                                         /*** AC1-Bits ***/
  488.         sprintf((char *)&mystrng[0], "*L%04d \0", bitnum);
  489.         if (AddString(&buff, (UBYTE *)&mystrng[0]))
  490.             return(-1);
  491.  
  492.         for (n = 0; n < AC1_SIZE; n++)
  493.         {
  494.             if (AddByte(&buff, (UBYTE)(Jedec.GALAC1[n] + '0')))
  495.                 return(-1);
  496.             bitnum++;
  497.         }
  498.  
  499.         if (AddByte(&buff, (UBYTE)'\n'))
  500.             return(-1);
  501.  
  502.  
  503.                                                         /*** PT-Bits ***/
  504.         sprintf((char *)&mystrng[0], "*L%04d \0", bitnum);
  505.         if (AddString(&buff, (UBYTE *)&mystrng[0]))
  506.             return(-1);
  507.  
  508.         for (n = 0; n < PT_SIZE; n++)
  509.         {
  510.             if (AddByte(&buff, (UBYTE)(Jedec.GALPT[n] + '0')))
  511.                 return(-1);
  512.             bitnum++;
  513.         }
  514.  
  515.         if (AddByte(&buff, (UBYTE)'\n'))
  516.             return(-1);
  517.  
  518.  
  519.                                                         /*** SYN-Bit ***/
  520.         sprintf((char *)&mystrng[0], "*L%04d \0", bitnum);
  521.  
  522.         if (AddString(&buff, (UBYTE *)&mystrng[0]))
  523.             return(-1);
  524.  
  525.         if (AddByte(&buff, (UBYTE)(Jedec.GALSYN + '0')))
  526.             return(-1);
  527.  
  528.         if (AddByte(&buff, (UBYTE)'\n'))
  529.             return(-1);
  530.  
  531.         bitnum++;
  532.  
  533.  
  534.                                                         /*** AC0-Bit ***/
  535.         sprintf((char *)&mystrng[0], "*L%04d \0", bitnum);
  536.  
  537.         if (AddString(&buff, (UBYTE *)&mystrng[0]))
  538.             return(-1);
  539.  
  540.         if (AddByte(&buff, (UBYTE)(Jedec.GALAC0 + '0')))
  541.             return(-1);
  542.  
  543.         if (AddByte(&buff, (UBYTE)'\n'))
  544.             return(-1);
  545.  
  546.     }
  547.  
  548.  
  549.  
  550.     if (Config.JedecFuseChk)
  551.     {                                   /* add fuse-checksum */
  552.         sprintf((char *)&mystrng[0], "*C%04x\n\0", FuseChecksum(GALType));
  553.  
  554.         if (AddString(&buff, (UBYTE *)&mystrng[0]))
  555.             return(-1);
  556.     }
  557.  
  558.  
  559.     if (AddString(&buff, (UBYTE *)"*\n"))                 /* closing '*' */
  560.         return(-1);
  561.  
  562.  
  563.     if (Config.JedecFileChk)
  564.     {
  565.         if (AddByte(&buff, (UBYTE)0x3))                     /* <ETX> */
  566.             return(-1);
  567.  
  568.         sprintf((char *)&mystrng[0], "%04x\n\0", FileChecksum(buff2));
  569.  
  570.         if (AddString(&buff, (UBYTE *)&mystrng[0]))
  571.             return(-1);
  572.     }
  573.  
  574.  
  575.     return(0);
  576. }
  577.  
  578.  
  579.  
  580.  
  581.  
  582. /******************************************************************************
  583. ** MakeJedecBuff()
  584. *******************************************************************************
  585. ** input:   galtype     type of GAL
  586. **
  587. ** output:  none
  588. **
  589. ** remarks: generats the JEDEC file out of the JEDEC structure
  590. ******************************************************************************/
  591.  
  592. void WriteJedecFile(int galtype)
  593. {
  594.     struct  ActBuffer       mybuff;
  595.     struct  Buffer          *first_buff;
  596.     BPTR    fh;
  597.     extern  char    path;
  598.     UBYTE   *filebuffer, *filebuffer2;
  599.     long    result;
  600.  
  601.  
  602.  
  603.     if (!(first_buff = (struct Buffer *)AllocMem((long)sizeof(struct Buffer),
  604.                                                   MEMF_PUBLIC|MEMF_CLEAR)))
  605.     {
  606.         ErrorReq(2);                                /* out of memory? */
  607.         return;
  608.     }
  609.  
  610.     mybuff.ThisBuff = first_buff;
  611.     mybuff.Entry    = (UBYTE *)(&first_buff->Entries[0]);
  612.     mybuff.BuffEnd  = (UBYTE *)first_buff + (long)sizeof(struct Buffer);
  613.  
  614.  
  615.  
  616.     if (MakeJedecBuff(mybuff, galtype))
  617.     {                                       /* put JEDEC in ram-buffer */
  618.         FreeBuffer(first_buff);             /* error?                  */
  619.         ErrorReq(2);
  620.         return;
  621.     }
  622.  
  623.     PrintText(AppStrings[MSG_WRITING_JED].as_Str, 1);
  624.  
  625.     if ((fh = Open(&path, (long)MODE_NEWFILE)))
  626.     {
  627.         for (;;)
  628.         {
  629.             filebuffer = filebuffer2 = mybuff.Entry;
  630.  
  631.             while (filebuffer2 < mybuff.BuffEnd)
  632.             {                                   /* get size of buffer */
  633.                 if (!*filebuffer2)
  634.                     break;
  635.                 filebuffer2++;
  636.             }
  637.                                                 /* save buffer */
  638.             result = Write(fh, (char *)filebuffer,
  639.                            (long)(filebuffer2 - filebuffer));
  640.  
  641.             if (result == -1L)
  642.             {                                   /* write error? */
  643.                 Close(fh);
  644.                 FreeBuffer(first_buff);
  645.                 PrintText(AppStrings[MSG_ERROR].as_Str ,0);
  646.                 ErrorReq(13);
  647.                 return;
  648.             }
  649.  
  650.             if (!mybuff.ThisBuff->Next)         /* more buffers here? */
  651.                 break;                          /* no, then cancel */
  652.  
  653.             mybuff.ThisBuff = mybuff.ThisBuff->Next;
  654.             mybuff.Entry    = (UBYTE *)(&mybuff.ThisBuff->Entries[0]);
  655.             mybuff.BuffEnd  = (UBYTE *)mybuff.ThisBuff + (long)sizeof(struct Buffer);
  656.         }
  657.  
  658.         Close(fh);
  659.     }
  660.     else
  661.     {
  662.         FreeBuffer(first_buff);                     /* error?, then cancel*/
  663.         PrintText(AppStrings[MSG_ERROR].as_Str ,0);
  664.         ErrorReq(13);                               /* can't open file */
  665.         return;
  666.     }
  667.  
  668.     PrintText(AppStrings[MSG_LOWER_OK].as_Str, 0);
  669.     FreeBuffer(first_buff);
  670. }
  671.  
  672.  
  673.  
  674.  
  675.  
  676. /******************************************************************************
  677. ** SearchNextChar()
  678. *******************************************************************************
  679. ** input:   none
  680. **
  681. ** output:  0:  no character found
  682. **         -1:  no more characters (end of file)
  683. **
  684. ** remarks: increments pointer to next character which is no TAB
  685. **          SPACE, CR
  686. **          starts searching at actptr + 1
  687. ******************************************************************************/
  688.  
  689. int SearchNextChar(void)
  690. {
  691.  
  692.     actptr++;
  693.  
  694.     while (*actptr)
  695.     {
  696.         switch (*actptr)
  697.         {
  698.             case  ' ':
  699.             case 0x09:
  700.                 break;
  701.  
  702.             case 0x0A:
  703.                 linenum++;
  704.                 break;
  705.  
  706.             default:
  707.                 return(0);
  708.         }
  709.         actptr++;
  710.     }
  711.     return(-1);
  712.  
  713. }
  714.  
  715.  
  716.  
  717.  
  718.  
  719. /******************************************************************************
  720. ** SearchNextAsterix()
  721. *******************************************************************************
  722. ** input:   none
  723. **
  724. ** output:  0:  found a '*'
  725. **         -1:  no more characters (end of file)
  726. **
  727. ** remarks: searches for '*' up to the end of the file
  728. **          starts searching at actptr
  729. ******************************************************************************/
  730.  
  731. int SearchNextAsterix(void)
  732. {
  733.  
  734.     while (*actptr)
  735.     {
  736.         if (*actptr == '*')
  737.             return(0);
  738.  
  739.         if (*actptr == 0x0A)
  740.             linenum++;
  741.         actptr++;
  742.     }
  743.  
  744.     return(-1);
  745. }
  746.  
  747.  
  748.  
  749.  
  750.  
  751. /******************************************************************************
  752. ** GetJedec()
  753. *******************************************************************************
  754. ** input:   *jedecfile  pointer to file name (".jed")
  755. **
  756. ** output:   0:  no error occured
  757. **         <>0:  error occured
  758. **
  759. ** remarks: This function reads a JEDEC file, checks it and generates
  760. **          the JEDEC structure.
  761. ******************************************************************************/
  762.  
  763. int GetJedec(UBYTE *jedecfile)
  764. {
  765.     extern  char    path;
  766.     LONG    filesize;
  767.     UBYTE   *filebuff, *ptr, *jedbuff, *jedptr;
  768.     int     n;
  769.     int     QFflag, QPflag, Fflag, Gflag, Cflag;
  770.     int     Lflag, STXflag, ETXflag, FCHKflag;
  771.     int     errornum, fuse_chk, file_chk;
  772.     unsigned int    num, fuse;
  773.     unsigned int    QF, QP, F;
  774.  
  775.  
  776.  
  777.     JedecGALType = NOT_SPECIFIED;
  778.  
  779.     filesize = FileSize(jedecfile);
  780.  
  781.     switch (filesize)
  782.     {
  783.         case -1L:
  784.             ErrorReq(1);
  785.             return(-1);
  786.             break;
  787.  
  788.         case -2L:
  789.             ErrorReq(2);
  790.             return(-2);
  791.             break;
  792.  
  793.         case 0L:
  794.             ErrorReq(4);
  795.             return(-4);
  796.             break;
  797.     }
  798.  
  799.  
  800.     if ((filebuff = (UBYTE *)AllocMem(filesize+2L, MEMF_PUBLIC|MEMF_CLEAR)))
  801.     {
  802.  
  803.         if ((ReadFile(jedecfile, filesize, filebuff)))
  804.         {
  805.  
  806.             PrintText(AppStrings[MSG_FILE_LOADED].as_Str, 1);
  807.  
  808.             actptr = filebuff;                         /* initialize variables */
  809.             linenum  = 1;
  810.             errornum = 0;
  811.             fuse     = 0;
  812.             QFflag = QPflag = Fflag = Gflag = Cflag = Lflag = 0;
  813.             FCHKflag = ETXflag = STXflag = 0;
  814.  
  815.             if (!(jedbuff = (UBYTE *)AllocMem((long)sizeof(Jedec),
  816.                                               MEMF_PUBLIC|MEMF_CLEAR)))
  817.             {
  818.                 FreeMem(filebuff, filesize);
  819.                 ErrorReq(2);                   /* no more free memory */
  820.                 return(-2);
  821.             }
  822.  
  823.             jedptr = jedbuff;
  824.  
  825.  
  826.             if (SearchNextAsterix())
  827.             {                 /* point to first instruction */
  828.                 FreeMem(jedbuff, (long)sizeof(Jedec)); /* buffer for the  */
  829.                 FreeMem(filebuff, filesize);           /* JEDEC strucutre */
  830.                 JedecError(1, YES);             /* unexpected end of file */
  831.                 return(1);
  832.             }
  833.  
  834.  
  835.             for (;;)
  836.             {
  837.                 if (SearchNextChar())           /* is there any character left? */
  838.                     break;                      /* no, then end this loop       */
  839.  
  840.                 switch (*actptr)
  841.                 {
  842.                     case 'Q':                   /*instructions introduced by Q*/
  843.                         actptr++;
  844.                         if (*actptr == 'F')
  845.                         {                       /*number of fuses in this file*/
  846.                             if (QFflag)
  847.                             {                   /* Befehl darf innerhalb des */
  848.                                 errornum = 7;   /* Jedec-Files nur einmal    */
  849.                                 break;          /* vorkommen                 */
  850.                             }
  851.  
  852.                             actptr++;
  853.  
  854.                             if (!isdigit(*actptr))
  855.                             {                       /* is there a number? */
  856.                                 errornum = 4;       /* no, then error     */
  857.                                 break;
  858.                             }
  859.  
  860.                             if (!sscanf((char *)actptr, "%d", &QF))
  861.                             {
  862.                                 errornum = 3;
  863.                                 break;
  864.                             }
  865.  
  866.                             while (isdigit(*actptr))           /* skip number */
  867.                                 actptr++;
  868.  
  869.                             QFflag = 1;
  870.  
  871.                             if (QF != 2194 && QF != 2706 && QF != 3274 && QF != 5892)
  872.                             {
  873.                                 errornum = 22;          /* unknown QF, then error */
  874.                                 break;
  875.                             }
  876.  
  877.                             if (QF == 2194)     /* get out of *QF type of GAL */
  878.                                 JedecGALType = GAL16V8;
  879.  
  880.                             if (QF == 2706)
  881.                                 JedecGALType = GAL20V8;
  882.  
  883.                             if (QF == 5892)
  884.                                 JedecGALType = GAL22V10;
  885.  
  886.                             if (QF == 3274)
  887.                                 JedecGALType = GAL20RA10;
  888.  
  889.                             break;
  890.                         }
  891.                                                 /* commands introduced by a P */
  892.                         if (*actptr == 'P')
  893.                         {                       /* number of pins */
  894.                             if (QPflag)
  895.                             {                   /* this instructions is allowed */
  896.                                 errornum = 8;   /* just once                    */
  897.                                 break;
  898.                             }
  899.  
  900.                             actptr++;
  901.  
  902.                             if (!isdigit(*actptr))
  903.                             {                              /* is there a number? */
  904.                                 errornum = 4;              /* no, then error     */
  905.                                 break;
  906.                             }
  907.  
  908.                             if (!sscanf((char *)actptr, "%d", &QP))
  909.                             {
  910.                                 errornum = 3;
  911.                                 break;
  912.                             }
  913.  
  914.                             while (isdigit(*actptr))        /* skip number */
  915.                                 actptr++;
  916.  
  917.                             QPflag = 1;
  918.                             break;
  919.                         }
  920.  
  921.                         errornum = 2;                   /* no QF,QP, then error */
  922.                         break;
  923.  
  924.  
  925.                     case 'F':                      /*** Fuse-Default ***/
  926.                         actptr++;
  927.  
  928.                         if (*actptr == '0')
  929.                             F = 0;
  930.                         else
  931.                             if (*actptr == '1')
  932.                                 F = 1;
  933.                             else
  934.                             {                           /* no 0 or 1 after F */
  935.                                 errornum = 5;           /* then error        */
  936.                                 break;
  937.                             }
  938.  
  939.                         for (n=fuse; n<sizeof(Jedec); n++)  /* default value */
  940.                             *(jedbuff + (long)n) = F;
  941.  
  942.                         Fflag = 1;
  943.                         break;
  944.  
  945.  
  946.                     case 'P':                   /*pins for test vectors */
  947.                     case 'V':                   /*test vector           */
  948.                     case 'N':                   /*comment               */
  949.                         break;                  /*do nothing            */
  950.  
  951.  
  952.                     case 'C':                   /*** Fuse-Checksum ***/
  953.                         if (Cflag)
  954.                         {                       /* only one fuse-chk. allowed */
  955.                             errornum = 24;
  956.                             break;
  957.                         }
  958.  
  959.                         actptr++;
  960.  
  961.                         if (!isxdigit(*actptr))
  962.                         {                           /* is there a hex. number? */
  963.                             errornum = 4;           /* no, then error          */
  964.                             break;
  965.                         }
  966.  
  967.                         if (!sscanf((char *)actptr, "%x", &fuse_chk))
  968.                         {
  969.                             errornum = 3;
  970.                             break;
  971.                         }
  972.  
  973.                         while (isxdigit(*actptr))            /* skip hex. number*/
  974.                             actptr++;
  975.  
  976.                         Cflag = 1;
  977.                         break;
  978.  
  979.  
  980.                     case 'L':                      /*** Fuse-Adresse ***/
  981.                         if (Cflag)
  982.                         {                          /* after *C no *L allowed */
  983.                             errornum = 10;
  984.                             break;
  985.                         }
  986.  
  987.                         actptr++;
  988.  
  989.                         if (!isdigit(*actptr))
  990.                         {                           /* is there a dez. number? */
  991.                             errornum = 4;           /* no, then error          */
  992.                             break;
  993.                         }
  994.  
  995.                         if (!sscanf((char *)actptr, "%d", &num))
  996.                         {
  997.                             errornum = 3;
  998.                             break;
  999.                         }
  1000.  
  1001.                         while (isdigit(*actptr))      /* skip dez. number */
  1002.                             actptr++;
  1003.  
  1004.                         if (num < fuse)
  1005.                         {                      /* is fuse adr. too low? */
  1006.                             errornum = 17;
  1007.                             break;
  1008.                         }
  1009.  
  1010.                         if ((num > fuse) && !Fflag)
  1011.                         {                           /* skip fuse address */
  1012.                             errornum = 18;          /* was there a *F? */
  1013.                             break;                  /* no, then error  */
  1014.                         }
  1015.  
  1016.                         if (SearchNextChar())
  1017.                         {                         /* no more characters?         */
  1018.                             errornum = 1;         /* then unexpected end of file */
  1019.                             break;
  1020.                         }
  1021.  
  1022.  
  1023.                         fuse = num;
  1024.  
  1025.                         for (;;)
  1026.                         {                           /*examine fuses*/
  1027.                             if ((*actptr == '1') || (*actptr == '0'))
  1028.                             {
  1029.                                 *(jedbuff + (long)fuse) = *actptr - '0';
  1030.                             }
  1031.                             else
  1032.                             {
  1033.                                 if (*actptr == '*')   /* next instruction? */
  1034.                                     break;            /* yes, then ready   */
  1035.                                 else
  1036.                                 {               /* no, then error '*' expected */
  1037.                                     errornum = 19;
  1038.                                     break;
  1039.                                 }
  1040.                             }
  1041.  
  1042.                             if (SearchNextChar())
  1043.                             {                     /* no more characters?         */
  1044.                                 errornum = 1;     /* then unexpected end of file */
  1045.                                 break;
  1046.                             }
  1047.                             fuse++;
  1048.  
  1049.                         }
  1050.  
  1051.                         Lflag = 1;
  1052.                         break;
  1053.  
  1054.  
  1055.                     case 'G':                      /*** Security ***/
  1056.                         if (QPflag)
  1057.                         {                      /* this instruction may appear */
  1058.                             errornum = 8;      /* just one time in the file   */
  1059.                             break;
  1060.                         }
  1061.                         actptr++;
  1062.  
  1063.                         if (*actptr == '0')
  1064.                             JedecSecurity = 0;
  1065.                         else
  1066.                             if (*actptr == '1')
  1067.                                 JedecSecurity = 1;
  1068.                             else
  1069.                             {                       /*  no 0 nor 1 after G? */
  1070.                                 errornum = 5;       /*  then error          */
  1071.                                 break;
  1072.                             }
  1073.  
  1074.                         Gflag = 1;
  1075.                         break;
  1076.  
  1077.  
  1078.                     case 0x02:                     /*** <STX> ***/
  1079.                         break;
  1080.  
  1081.  
  1082.                     case 0x03:                     /*** <ETX> then File-Checksum ***/
  1083.                         ptr = filebuff;
  1084.                         file_chk = 0;
  1085.                         while (*ptr)
  1086.                         {
  1087.                             if (*ptr == 0x02)
  1088.                             {                        /* multiple <STX> */
  1089.                                 if (STXflag)
  1090.                                 {
  1091.                                     errornum = 12;
  1092.                                     break;
  1093.                                 }
  1094.  
  1095.                                 if (ETXflag)
  1096.                                 {                           /* STX before ETX? */
  1097.                                     errornum = 14;
  1098.                                     break;
  1099.                                 }
  1100.                                 STXflag = 1;
  1101.                             }
  1102.  
  1103.                             if (*ptr == 0x03)
  1104.                             {                        /* <ETX> */
  1105.                                 if (ETXflag)
  1106.                                 {                           /* mulitple? */
  1107.                                     errornum = 13;
  1108.                                     break;
  1109.                                 }
  1110.  
  1111.                                 if (!STXflag)
  1112.                                 {                          /* STX vor ETX? */
  1113.                                     errornum = 14;
  1114.                                     break;
  1115.                                 }
  1116.                                 ETXflag = 1;
  1117.                             }
  1118.  
  1119.                             if (STXflag && !ETXflag)       /* add to checksum */
  1120.                                 file_chk += *ptr;
  1121.  
  1122.                             ptr++;
  1123.                         }
  1124.  
  1125.                         file_chk += 0x03;                  /* add ETX */
  1126.                         actptr++;
  1127.  
  1128.                         if (!isxdigit(*actptr))
  1129.                         {                           /* is there a hex. number? */
  1130.                             errornum = 4;           /* no, then error          */
  1131.                             break;
  1132.                         }
  1133.  
  1134.                         if (!sscanf((char *)actptr, "%x", &num))
  1135.                         {
  1136.                             errornum = 3;
  1137.                             break;
  1138.                         }
  1139.  
  1140.                         while (isxdigit(*actptr))   /* skip hex. number */
  1141.                             actptr++;
  1142.  
  1143.                         if (file_chk != num)
  1144.                         {
  1145.                             if (!TxtRequest(AppStrings[MSG_BAD_FILECHK].as_Str,
  1146.                                             AppStrings[MSG_CONT_GAD].as_Str,
  1147.                                             AppStrings[MSG_CANCEL_GAD].as_Str))
  1148.                             {
  1149.                                 errornum = 16;
  1150.                                 break;
  1151.                             }
  1152.                         }
  1153.  
  1154.                         FCHKflag = 1;
  1155.                         break;
  1156.                     }
  1157.  
  1158.  
  1159.                     if (errornum)
  1160.                     {                       /* was there an error? yes, then end */
  1161.                         FreeMem(jedbuff, (long)sizeof(Jedec));
  1162.                         FreeMem(filebuff, filesize);
  1163.                         JedecError(errornum, YES);
  1164.                         return(errornum);
  1165.                     }
  1166.  
  1167.                     if (FCHKflag)                   /* File-Checksum?       */
  1168.                         break;                      /* yes, then break loop */
  1169.  
  1170.                     if (SearchNextAsterix())        /* search for final '*' */
  1171.                         errornum = 9;
  1172.                 }
  1173.  
  1174.  
  1175.                 if (!Lflag && !Fflag)
  1176.                 {                                            /* no fuses?    */
  1177.                     FreeMem(filebuff, filesize);             /* then error   */
  1178.                     FreeMem(jedbuff, (long)sizeof(Jedec));   /* free buffers */
  1179.                     JedecError(21, NO);
  1180.                     return(21);
  1181.                 }
  1182.  
  1183.                 if (QFflag)
  1184.                 {                              /* does *L.. fit to *QF? */
  1185.                     if ((fuse != QF && !Fflag) || (fuse > QF))
  1186.                     {
  1187.                         FreeMem(filebuff, filesize);       /* no, then error */
  1188.                         FreeMem(jedbuff, (long)sizeof(Jedec));
  1189.                         JedecError(20, NO);
  1190.                         return(20);
  1191.                     }
  1192.                 }
  1193.                 else
  1194.                 {
  1195.                     if (Fflag)
  1196.                     {                             /* try to identify the type of */
  1197.                         if (fuse > 3274 && fuse <= 5892) /* GAL for which this   */
  1198.                             JedecGALType = GAL20RA10;    /* JEDEC file is        */
  1199.  
  1200.                         if (fuse <= 2194)        /* less than 2194 fuses => 16V8 */
  1201.                             JedecGALType = GAL16V8;
  1202.  
  1203.                         if (fuse > 5892)
  1204.                         {                     /* too many fuses for the known  */
  1205.                             FreeMem(jedbuff, (long)sizeof(Jedec)); /* types of */
  1206.                             FreeMem(filebuff, filesize);      /* GALs => error */
  1207.                             JedecError(6, NO);
  1208.                             return(23);
  1209.                         }
  1210.                     }
  1211.                     else
  1212.                     {
  1213.                         if (fuse != 2194 && fuse != 2706 && fuse !=5892 && fuse != 3274)
  1214.                         {
  1215.                             FreeMem(jedbuff, (long)sizeof(Jedec));
  1216.                             FreeMem(filebuff, filesize);
  1217.                             JedecError(6, NO);
  1218.                             return(6);
  1219.                     }
  1220.  
  1221.                     if (fuse == 2194)            /* if there was no QF and no    */
  1222.                         JedecGALType = GAL16V8;  /* F instruction, identify type */
  1223.                                                  /* of GAL by the last fuse      */
  1224.                     if (fuse == 2706)            /* address                      */
  1225.                         JedecGALType = GAL20V8;
  1226.  
  1227.                     if (fuse == 5892)
  1228.                         JedecGALType = GAL22V10;
  1229.  
  1230.                     if (fuse == 3274)
  1231.                         JedecGALType = GAL20RA10;
  1232.  
  1233.                 }
  1234.             }
  1235.  
  1236.             if (FCHKflag)                              /*file checksum?*/
  1237.                 if (!SearchNextChar())
  1238.                 {                           /* are there any more characters? */
  1239.                     FreeMem(filebuff, filesize);           /* yes, then error */
  1240.                     FreeMem(jedbuff, (long)sizeof(Jedec));
  1241.                     JedecError(15, YES);
  1242.                     return(15);
  1243.                 }
  1244.  
  1245.  
  1246.                                             /*** initialize JEDEC structure ***/
  1247.             for (n = 0; n < sizeof(Jedec); n++)
  1248.             {
  1249.  
  1250.                 if (JedecGALType == GAL16V8)
  1251.                 {                               /*** GAL16V8 ***/
  1252.  
  1253.                     if ((n < 2048) || (n > 5807 && n < 5816) || (n > 5817 && n < 5956))
  1254.                     {
  1255.                         Jedec.GALLogic[n] = *jedptr; /*get matrix, XOR, signature*/
  1256.                         jedptr++;                    /*AC1, PT, SYN and AC0      */
  1257.                     }
  1258.                     else
  1259.                         Jedec.GALLogic[n] = 0;
  1260.  
  1261.                 }
  1262.  
  1263.                 if (JedecGALType == GAL20V8)
  1264.                 {                               /*** GAL20V8 ***/
  1265.  
  1266.                     if ((n < 2560) || (n > 5807 && n < 5816) || (n > 5817 && n < 5956))
  1267.                     {
  1268.                         Jedec.GALLogic[n] = *jedptr; /*get matrix, XOR, signature*/
  1269.                         jedptr++;                    /*AC1, PT, SYN and AC0      */
  1270.                     }
  1271.                     else
  1272.                         Jedec.GALLogic[n] = 0;
  1273.  
  1274.                 }
  1275.  
  1276.  
  1277.                 if (JedecGALType == GAL22V10)
  1278.                 {                               /*** GAL22V10 ***/
  1279.  
  1280.                     if (n < 5808 || (n > 5817 && n < 5882))
  1281.                     {
  1282.                         Jedec.GALLogic[n] = *jedptr; /* get matrix, signature */
  1283.                         jedptr++;
  1284.                     }
  1285.                     else
  1286.                     {
  1287.                         if (n > 5807 && n < 5818)
  1288.                         {
  1289.                             Jedec.GALXOR[n - 5808] = *jedptr;   /* get XORs */
  1290.                             jedptr++;
  1291.  
  1292.                             Jedec.GALS1[n - 5808] = *jedptr;    /* get S1 */
  1293.                             jedptr++;
  1294.                         }
  1295.                         else
  1296.                             if (n < 5956 || n > 5965)  /*don't erase S1, it's*/
  1297.                                 Jedec.GALLogic[n] = 0; /*set when n>5807     */
  1298.                     }
  1299.                 }
  1300.  
  1301.  
  1302.                 if (JedecGALType == GAL20RA10)
  1303.                 {                               /*** GAL20RA10 ***/
  1304.  
  1305.                     if ((n < 3200) || (n > 5807 && n < 5882))
  1306.                     {                                      /* get matrix, XOR */
  1307.                         Jedec.GALLogic[n] = *jedptr;       /* and signature   */
  1308.                         jedptr++;
  1309.                     }
  1310.                     else
  1311.                         Jedec.GALLogic[n] = 0;
  1312.  
  1313.                 }
  1314.  
  1315.  
  1316.             }
  1317.  
  1318.  
  1319.             if (Cflag)
  1320.             {                       /* test whether checksum is o.k. or not */
  1321.                 if (fuse_chk != FuseChecksum(JedecGALType))
  1322.                 {
  1323.                     if (!TxtRequest(AppStrings[MSG_BAD_FUSECHK].as_Str,
  1324.                        AppStrings[MSG_CONT_GAD].as_Str,
  1325.                        AppStrings[MSG_CANCEL_GAD].as_Str))
  1326.                     {
  1327.                         FreeMem(filebuff, filesize);
  1328.                         FreeMem(jedbuff, (long)sizeof(Jedec));
  1329.                         JedecError(11, NO);         /* bad fuse checksum */
  1330.                         return(11);
  1331.                     }
  1332.                 }
  1333.             }
  1334.  
  1335.             FreeMem(jedbuff, (long)sizeof(Jedec)); /* free JEDEC struct. buf. */
  1336.             FreeMem(filebuff, filesize);           /* free JEDEC file buffer  */
  1337.             return(0);                             /* no error occured        */
  1338.  
  1339.         }
  1340.         else
  1341.         {
  1342.             ErrorReq(3);                            /* read error */
  1343.             FreeMem(filebuff, filesize);
  1344.             return(-2);
  1345.         }
  1346.  
  1347.     }
  1348.     else
  1349.     {
  1350.         ErrorReq(2);                            /* not enough free memory */
  1351.         return(-2);
  1352.     }
  1353.  
  1354. }
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360. /******************************************************************************
  1361. ** JedecError()
  1362. *******************************************************************************
  1363. ** input:   errornum    error number
  1364. **          flag        signs whether there should be a line number printed
  1365. **                      or not
  1366. **
  1367. ** output:  none
  1368. **
  1369. ** remarks: prints an error text
  1370. ******************************************************************************/
  1371.  
  1372. void JedecError(int errornum, int flag)
  1373. {
  1374.  
  1375.     if (flag)
  1376.         PrintErrorLine(linenum);
  1377.  
  1378.     switch (errornum)
  1379.     {
  1380.         case  1:
  1381.             PrintText(AppStrings[MSG_ERR_JED1].as_Str, 1);
  1382.             break;
  1383.  
  1384.         case  2:
  1385.             PrintText(AppStrings[MSG_ERR_JED2].as_Str, 1);
  1386.             break;
  1387.  
  1388.         case  3:
  1389.             PrintText(AppStrings[MSG_ERR_JED3].as_Str, 1);
  1390.             break;
  1391.  
  1392.         case  4:
  1393.             PrintText(AppStrings[MSG_ERR_JED4].as_Str, 1);
  1394.             break;
  1395.  
  1396.         case  5:
  1397.             PrintText(AppStrings[MSG_ERR_JED5].as_Str, 1);
  1398.             break;
  1399.  
  1400.         case  6:
  1401.             PrintText(AppStrings[MSG_ERR_JED6].as_Str, 1);
  1402.             break;
  1403.  
  1404.         case  7:
  1405.             PrintText(AppStrings[MSG_ERR_JED7].as_Str, 1);
  1406.             break;
  1407.  
  1408.         case  8:
  1409.             PrintText(AppStrings[MSG_ERR_JED8].as_Str, 1);
  1410.             break;
  1411.  
  1412.         case  9:
  1413.             PrintText(AppStrings[MSG_ERR_JED9].as_Str, 1);
  1414.             break;
  1415.  
  1416.         case 10:
  1417.             PrintText(AppStrings[MSG_ERR_JED10].as_Str, 1);
  1418.             break;
  1419.  
  1420.         case 11:
  1421.             PrintText(AppStrings[MSG_ERR_JED11].as_Str, 1);
  1422.             break;
  1423.  
  1424.         case 12:
  1425.             PrintText(AppStrings[MSG_ERR_JED12].as_Str, 1);
  1426.             break;
  1427.  
  1428.         case 13:
  1429.             PrintText(AppStrings[MSG_ERR_JED13].as_Str, 1);
  1430.             break;
  1431.  
  1432.         case 14:
  1433.             PrintText(AppStrings[MSG_ERR_JED14].as_Str, 1);
  1434.             break;
  1435.  
  1436.         case 15:
  1437.             PrintText(AppStrings[MSG_ERR_JED15].as_Str, 1);
  1438.             break;
  1439.  
  1440.         case 16:
  1441.             PrintText(AppStrings[MSG_ERR_JED16].as_Str, 1);
  1442.             break;
  1443.  
  1444.         case 17:
  1445.             PrintText(AppStrings[MSG_ERR_JED17].as_Str, 1);
  1446.             break;
  1447.  
  1448.         case 18:
  1449.             PrintText(AppStrings[MSG_ERR_JED18].as_Str, 1);
  1450.             break;
  1451.  
  1452.         case 19:
  1453.             PrintText(AppStrings[MSG_ERR_JED19].as_Str, 1);
  1454.             break;
  1455.  
  1456.         case 20:
  1457.             PrintText(AppStrings[MSG_ERR_JED20].as_Str, 1);
  1458.             break;
  1459.  
  1460.         case 21:
  1461.             PrintText(AppStrings[MSG_ERR_JED21].as_Str, 1);
  1462.             break;
  1463.  
  1464.         case 22:
  1465.             PrintText(AppStrings[MSG_ERR_JED22].as_Str, 1);
  1466.             break;
  1467.  
  1468.         case 23:
  1469.             PrintText(AppStrings[MSG_ERR_JED23].as_Str, 1);
  1470.             break;
  1471.  
  1472.         case 24:
  1473.             PrintText(AppStrings[MSG_ERR_JED24].as_Str, 1);
  1474.             break;
  1475.  
  1476.         case 25:
  1477.             PrintText(AppStrings[MSG_ERR_JED25].as_Str, 1);
  1478.             break;
  1479.  
  1480.     }
  1481.  
  1482.     ErrorReq(5);
  1483. }
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490. /* EOF */
  1491.